package operation;

import book.BookList;

import java.util.Scanner;

public class BorrowOperation implements IOperation{
    @Override
    public void work(BookList bookList) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入要借阅书的书名");
        int size=bookList.getUseSize();
        String name=scanner.nextLine();
        for (int i = 0; i < size; i++) {
            if(bookList.getbook(i).getName().equals(name)){
               bookList.getbook(i).setBorrowed(true);
                System.out.println("成功借出");
                return;
            }
        }
        System.out.println("你要借的书不存在");
    }
}
